package player;

import java.awt.AWTEvent;
import java.awt.BorderLayout;  
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;  
import javax.swing.JOptionPane;
import javax.swing.JPanel;  

import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;  
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;  
  
public class Window extends JFrame{  
      
    private JPanel contentPane; //顶层容器，整个播放页面的容器  
      
    EmbeddedMediaPlayerComponent playerComponent;   //媒体播放器组件  
      
    public static void main(String[] args) {  
          
    }  
  
    //MainWindow构造方法，创建视屏播放的主界面  
    public Window(){  
    	
    	ImageIcon image = new ImageIcon("image/avatar.png");
		this.setIconImage(image.getImage());
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		int tolWidth = (int)d.getWidth();
		int tolHeight = (int)d.getHeight();
        setBounds(0,0,tolWidth,tolHeight);  
//      frame.setBounds(0,0,800,600);  
        contentPane=new JPanel();  
//        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));  
        contentPane.setLayout(null);  
        contentPane.setBounds(0, 0, tolWidth,tolHeight);
        
        contentPane.setBackground(null);
        contentPane.setOpaque(false);
        
        CloseBtn closeBtn = new CloseBtn();
        int btnWidth = closeBtn.icon.getIconWidth();
        int btnHeight = closeBtn.icon.getIconHeight();
        closeBtn.setBounds(tolWidth-btnWidth-5, 5, btnWidth, btnHeight);
        add(closeBtn);
        add(contentPane);  
        
          
        /*视屏窗口中播放界面部分*/  
        JPanel videoPane=new JPanel();
        videoPane.setBounds(0, 0, (int)d.getWidth(),(int)d.getHeight());
        
        contentPane.add(videoPane);  
        
        
        videoPane.setLayout(new BorderLayout(0,0));  
        playerComponent=new EmbeddedMediaPlayerComponent();  
        videoPane.add(playerComponent);  
        
    }  
      
    //获取播放媒体实例（某个视频）  
    public EmbeddedMediaPlayer getMediaPlayer() {  
        return playerComponent.getMediaPlayer();  
    }

    
      
}  